
$:.unshift(File.dirname(__FILE__) + '/../')

require 'test/unit'
require 'style/default/cornostyle'

require 'pp'

class TC_CornoStyle < Test::Unit::TestCase
  def setup
  end

  def teardown
  end

  def test_convert_blockquote
    r = CornoStyle.to_html(<<-CONTENS)
>>
abcdefghij
0123456789
<<
    CONTENS

    contents = <<-RESULT_CONTENTS
<blockquote>
abcdefghij
0123456789
</blockquote>
RESULT_CONTENTS

    assert_equal(contents, r)
  end

  def test_convert_super_pre
    r = CornoStyle.to_html(<<-CONTENS)
>||
class Foo
  def bar
  end
end
||<
    CONTENS

    contents = <<-RESULT_CONTENTS
<pre>class Foo
  def bar
  end
end
</pre>
    RESULT_CONTENTS

    assert_equal(contents, r)
  end

  def test_convert_title
    r = CornoStyle.to_html(<<-CONTENS)
** title1

*** title2

**** title3

    CONTENS

    contents = <<-RESULT_CONTENTS
<h3>title1</h3>

<h4>title2</h4>

<h5>title3</h5>

    RESULT_CONTENTS

    assert_equal(contents, r)
  end

  def test_convert_horizontal_rule
    r = CornoStyle.to_html(<<-CONTENS)

----

    CONTENS

    contents = <<-RESULT_CONTENTS

<hr />

    RESULT_CONTENTS

    assert_equal(contents, r)
  end

  def test_convert_plugin
    r = CornoStyle.to_html(<<-CONTENS)

{{plugin1 ("argv1")}}

    CONTENS

    contents = <<-RESULT_CONTENTS

{{plugin1 ("argv1")}}

    RESULT_CONTENTS

    assert_equal(contents, r)
  end
end

